<!--
 * @Description: 
 * @Author: gphper
 * @Date: 2021-10-19 20:03:26
-->
{{define "head"}}
<link rel="stylesheet" href="/statics/js/layui/css/layui.css">
{{end}}

{{define "body"}}
<div class="container-fluid p-t-15">
  
    <div class="row">
      <div class="col-lg-12">
        <div class="card">
         
          <div class="card-toolbar clearfix">
            <form role="form" class="form-inline pull-right" method="get">
                <div class="form-group">
                    <label class="sr-only">标题</label>
                    <input type="text" name="title" placeholder="标题" class="form-control" value="{{.nickname}}">
                </div>
                &nbsp;&nbsp;
                <div class="form-group">
                    <input placeholder="请选择注册时间范围" class="form-control" id="created_at" type="text" name="created_at" value="{{.created_at}}" style="width: 200px;"
                           autocomplete="off">
                </div>
                <button type="submit" class="btn btn-primary">搜索</button>
                <button type="button" class="btn btn-white" onclick="location.href='/admin/article/list'">重置</button>
            </form>
            <div class="toolbar-btn-action">
              {{if judgeContainPriv $.username "/admin/article/add" "get"}}
              <a class="btn btn-primary m-r-5" href="/admin/article/add"><i class="mdi mdi-plus"></i> 新增</a>
              {{end}}
            </div>
          </div>

          <div class="card-body">
            
            <div class="table-responsive">
              <table class="table table-bordered">
                <thead>
                  <tr>
                    <th>文章ID</th>
                    <th>标题</th>
                    <th>简介</th>
                    <th>添加时间</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  {{range .articleData.Data}}
                  <tr>
                      <td>{{.ArticleId}}</td>
                      <td>{{.Title}}</td>
                      <td>{{.Desc}}</td>
                      <td>{{formatAsDate .CreatedAt "2006-01-02 15:04:05"}}</td>
                      <td>
                        {{if judgeContainPriv $.username "/admin/article/edit" "get"}}
                          <a class="btn btn-xs btn-default" href="/admin/article/edit?article_id={{.ArticleId}}" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                        {{end}}
                        {{if judgeContainPriv $.username "/admin/article/del" "get"}}
                          <a class="btn btn-xs btn-default ajaxBtn" href="javascript:void(0);" uri="/admin/article/del?article_id={{.ArticleId}}" msg="是否删除该内容？" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                        {{end}}  
                        
                      </td>
                  </tr>
                  {{end}}
                </tbody>
              </table>
            </div>
            {{ .articleData.PageHtml }}
          </div>
        </div>
      </div>
    </div>
    
  </div>
{{end}}

{{define "script"}}
<script type="text/javascript" src="/statics/js/layui/layui.js"></script>
<script type="text/javascript">
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#created_at',
            range: '~',
            max: 0
        });
    });
</script>
{{end}}